import React, { Component } from 'react';

import CommonListPage from '../common/CommonListPage';

import {
  StyleSheet,
  View,
  ScrollView,
  TouchableOpacity,
  Text,
  Keyboard,
  Platform,
  Image
} from 'react-native';
import SearchItemView from './SearchItemView';
import Config from '../../config';
import SizeUtils from '../../common/SizeUtils';
import CommonStyles from '../../common/CommonStyles';
import TImage from '../../components/TImage';
import UserRequestSaerchListAction from '../../actions/user/UserRequestSaerchListAction';

export default class SearchListView extends CommonListPage {
  constructor(props){
    super(props);
    this.state.type=this.props.pageData.routeData.type;
    this.state.data = [];
  }
  _dealLeavePage(){
    this.leave();
  }
  _getViewStyle() {
     return {paddingTop:Config.paddingTop,
        height:SizeUtils.getWindowSize().height-Config.paddingTop,
        backgroundColor:"#ffffff"}
  }
  _getListViewStyle() {
      return {
        width:SizeUtils.getWindowSize().width,
        paddingTop:0,
        height:SizeUtils.getWindowSize().height - Config.paddingTop,
        backgroundColor:"#fff"};
  }
  _onRenderItem(data, index) {
    return(<SearchItemView key={index} pageData={this.props.pageData} loveData={this.props.pageData.routeData.loveData} keyWord={this.props.pageData.routeData.keyWord} data={data} index={index} type={this.props.pageData.routeData.type} />)
  }
  _requestData(page, listView) {
    new UserRequestSaerchListAction().call(listView, {page:page,page_size:10,key:this.props.pageData.routeData.keyWord,type:this.props.pageData.routeData.type})
  }
}